/**
 * Copyright 2016-2017 TVI Go Easy.
 * Created on 2017/4/14 01:48
 */
package org.mechanic.fund.domain.system.manager;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.mechanic.fund.domain.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import java.util.Set;

/**
 * 标签实体
 *
 * @author mechanic
 * @version 0.0.1
 */
@Entity
@Table(name = "sys_tag")
public class Tag extends BaseEntity {

    private static final long serialVersionUID = 8723160657204902733L;
    /**
     * 标签名称
     */
    @Column(name = "name")
    private String name;

    /**
     * 用户
     */
    @ManyToMany(mappedBy = "tags")
    private Set<User> users;

    public Tag() {
    }

    public Tag(String name, String id) {
        this.id = id;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Set<User> getUsers() {
        return users;
    }

    public void setUsers(Set<User> users) {
        this.users = users;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
